var httpManager = new HttpManager();
var selectedImageId;

function load()
{
    ;
}

function toggleSubmitPanel(element) {
    var panel = document.getElementById("submit_panel");
    var panelForm = document.getElementById("file_upload_form");

    if ( panel.style.visibility == "hidden" ) {
        var bottomX = Position.findAbsoluteLeft(element);
        var bottomY = Position.findAbsoluteTop(element);
        var elementW = element.scrollWidth;

        panel.style.left = bottomX - (Number(panel.style.width.replace("px", "")) - elementW) / 2;
        panel.style.top = bottomY;
        slideCallBack = function() {
            panelForm.style.visibility = "visible";
        };
        slideUp(panel, 0, panel.style.height.replace("px", ""), 50);
        panel.style.visibility = "visible";
        fufTarget = window.frames["upload_target"]; 
        fufTarget.document.body.innerHTML = "";
        resetUploadForm();
    }
    else {
        panelForm.style.visibility = "hidden";
        var panelOriginalH = panel.style.height.replace("px", "");
        slideCallBack = function() {
            panel.style.visibility = "hidden";
            panel.style.height = panelOriginalH;
        };
        slideDown(panel, panelOriginalH, 0, 50);
    }
}

function tryEnableUploadSubmitButton() {
    fufFile = document.getElementById("fuf_file");
    fufDescription = document.getElementById("fuf_description");
    fufSource = document.getElementById("fuf_source");
    fufEmail = document.getElementById("fuf_email");
    fufSubmit = document.getElementById("fuf_submit");

    if ( fufFile.value != "" && fufDescription.value != "" && fufSource.value != "" && fufEmail.value != "" ) {
        fufSubmit.disabled = false;
    }
    else {
        fufSubmit.disabled = true;
    }
}

function resetUploadForm() {
    fuf = document.getElementById("file_upload_form");
    fufSubmit = document.getElementById("fuf_submit");
    //fufTarget = document.getElementById("upload_target");
    fuf.reset();
    fufSubmit.disabled = true;
}
